#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define mod 1000000007
#define MOD 999999997
using namespace std;
inline int read(){
    int k=0,f=1;
	char ch=getchar();
    while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
		k=k*10+ch-'0';
		ch=getchar();
	}
    return k*f;
}
const int N=1e5+10;
int n,f[N][3],a[N][3];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    freopen("summer.in","r",stdin);
    freopen("summer.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
    for(int i=1;i<=n;i++){
    	f[i][0]=max(f[i-1][1],f[i-1][2])+a[i][0];
    	f[i][1]=max(f[i-1][2],f[i-1][0])+a[i][1];
    	f[i][2]=max(f[i-1][0],f[i-1][1])+a[i][2];
    }
	f[n][0]=max(f[n][0],f[n][1]);
    cout<<max(f[n][2],f[n][0]);
	return 0;
}

